# -*- mode: python -*-

block_cipher = None


dirs  = ['.\\webapp\\static', '.\\webapp\\templates', '.\\pinyin', '.\\dlls']
datas = []
import os
import apscheduler

for dir in dirs:
    for dirpath, dirnames, filenames in os.walk(dir):
        for filename in filenames:
            if filename.endswith(".dll"):
                datas.append((os.path.join(dirpath,filename),""))
            else:
                datas.append((os.path.join(dirpath,filename),dirpath[2:]))

analysis = []
for dirpath, dirnames, filenames in os.walk("."):
    for filename in filenames:
        if filename.endswith(".py"):
            analysis.append(os.path.join(dirpath,filename))

hiddenimports = []
for dirpath, dirnames, filenames in os.walk(".\\webapp\\apis"):
    for filename in filenames:
        if filename.endswith(".py") and filename != "__init__.py":
            hiddenimports.append("webapp.apis." + filename[0: -3])

a = Analysis(analysis,
             pathex=['.'],
             binaries=[],
             datas=datas + [('logging.conf',''),('ca-cert',''),('bitbug_favicon.ico',''),('main.png',''),('windows\\run.png','')],
             hiddenimports=hiddenimports,
             hookspath=['webapp\\static','webapp\\templates'],
             runtime_hooks=[],
             excludes=[],
             win_no_prefer_redirects=False,
             win_private_assemblies=False,
             cipher=block_cipher)
pyz = PYZ(a.pure, a.zipped_data,
             cipher=block_cipher)
exe = EXE(pyz,
          a.scripts,
          exclude_binaries=True,
          name='main',
          debug=False,
          strip=False,
          upx=True,
          console=False,icon='bitbug_favicon.ico' )
coll = COLLECT(exe,
               a.binaries,
               a.zipfiles,
               a.datas,
               strip=False,
               upx=True,
               name='main')
